<?php
namespace app\admin\inter_model;

use think\Db;

class HotAreaModel
{
    public function addHotArea($data)
    {
        return Db::table('inter_hot_area')->insertGetId($data);
    }

    public function updateHotArea($map,$data)
    {
        return Db::table('inter_hot_area')->where($map)->update($data);
    }

    public function getHotArea($map,$field='a.*',$page=1,$limit=10)
    {

        return Db::connect(config('intercity_db'))->name('hot_area a')->join('arean b','a.arean_id=b.id','LEFT')
            ->where($map)->field($field)->page($page,$limit)->order('a.id desc')->select();
    }

    public function searchHotArea($map,$field='a.*')
    {
        return Db::connect(config('intercity_db'))->name('hot_area a')->join('arean b','a.arean_id=b.id','LEFT')
            ->where($map)->field($field)->find();
    }

    public function delHotArea($map)
    {
        return Db::table('inter_hot_area')->where($map)->delete();
    }
}
